package ch.zbw.timeline.presentation;

import java.sql.Time;
import java.util.Calendar;
import java.util.List;

import javax.swing.text.JTextComponent;

import ch.zbw.timeline.domain.Allocation;
import ch.zbw.timeline.domain.DailyPresence;
import ch.zbw.timeline.domain.Employee;
import ch.zbw.timeline.domain.Entry;
import ch.zbw.timeline.domain.HolidayFormula;
import ch.zbw.timeline.domain.LogEntry;
import ch.zbw.timeline.domain.OverTimePool;
import ch.zbw.timeline.domain.Period;
import ch.zbw.timeline.domain.Process;
import ch.zbw.timeline.domain.Role;
import ch.zbw.timeline.domain.Statistic;
import ch.zbw.timeline.domain.Task;
import ch.zbw.timeline.domain.YearConfig;

/**
 * Interface for views using the Model-View-Presenter pattern
 * 
 * @author Daniel Stefanovic
 * @version 12.11.2011
 * 
 */
public interface ClientView {
	
	/**
	 * Add the event listener (client presenter) to the view
	 * 
	 * @param listener event listener
	 */
	public void addEventListener(ClientEventListener listener);
	
	/**
	 * Show an error message box
	 * 
	 * @param title title of the message box
	 * @param message text of the message box
	 */
	public void showError(String title, String message);
	
	/**
	 * Show an info message box
	 * 
	 * @param title title of the message box
	 * @param message text of the message box
	 */
	public void showInfo(String title, String message);
	
	/**
	 * Show an yes/no question message box
	 * 
	 * @param title title of the message box
	 * @param text text of the message box
	 * @return yes clicked?
	 */
	public boolean showYesNoQuestion(String title, String text);
	
	/**
	 * Set the connected status
	 * 
	 * @param connected connected?
	 */
	public void setConnected(boolean connected);
	
	/**
	 * Show the login form
	 */
	public void showLoginForm();
	
	/**
	 * Set the roles to the view
	 * 
	 * @param roles employee roles
	 */
	public void setRoles(List<Role> roles);
	
	/**
	 * Get the user name from login window
	 *  
	 * @return user name
	 */
	public String getLoginUserName();
	
	
	/**
	 * Get the password from the login window
	 * 
	 * @return password
	 */
	public String getLoginPassword();

	/**
	 * Get the login role from the login window
	 * 
	 * @return role
	 */
	public Role getLoginRole();
	
	/**
	 * Changes the content panel
	 * 
	 * @param menuType menu type
	 */
	public void changeContent(MenuType menuType);
	
	/**
	 * Returns the statistic textarea
	 * 
	 * @return statistic textarea
	 */
	public JTextComponent getStatisticTextArea();

	/**
	 * Set the date of presence
	 * 
	 * @param dateOfPresence date of presence
	 */
	public void setDate(Calendar dateOfPresence);

	/**
	 * Set the entries
	 * 
	 * @param entries dailypresence entries
	 */
	public void setEntries(List<Entry> entries);
	
	/**
	 * Set the employees
	 * 
	 * @param employees list of employees
	 */
	public void setEmployees(List<Employee> employees);

	/**
	 * Changes the admin content panel
	 * 
	 * @param adminContentPanel admin menu
	 */
	public void changeContentAdmin(AdminContent adminContentPanel);
	
	/**
	 * Sets the operation visibility in the menu bar
	 * 
	 * @param newVisible is button new visible?
	 * @param editVisible is button edit visible?
	 * @param deleteVisible is button edit visible?
	 */
	public void setOperationVisibility(boolean newVisible, boolean editVisible, boolean deleteVisible);
	
	/**
	 * Sets the operation tooltips in the menu bar
	 * 
	 * @param newOperation tooltip for the new button
	 * @param editOperation tooltip for the edit button
	 * @param deleteOperation tooltip for the delete button
	 */
	public void setOperationToolTips(String newOperation, String editOperation, String deleteOperation);

	/**
	 * Set the logged in employee
	 * 
	 * @param employee employee
	 */
	public void setEmployee(Employee employee);

	/**
	 * Get the old password from input field
	 * 
	 * @return old password
	 */
	public String getOldPassword();

	/**
	 * Get the new password from input field
	 * 
	 * @return new password
	 */
	public String getNewPassword();

	/**
	 * Clear the password fields
	 */
	public void clearPasswordFields();

	/**
	 * Disable the administration view
	 */
	public void disableAdministration();
	
	/**
	 * Set the list of processes
	 * 
	 * @param processes list of processes
	 */
	public void setProcesses(List<Process> processes);

	/**
	 * Set the list of tasks
	 * 
	 * @param allTasks list of tasks
	 */
	public void setTasks(List<Task> allTasks);

	/**
	 * Set the list of allocations
	 * 
	 * @param allAllocations list of allocations
	 */
	public void setAllocations(List<Allocation> allAllocations);

	/**
	 * Set the list of holiday formulas
	 * 
	 * @param allHolidayFormulas list of holiday formulas
	 */
	public void setHolidayFormulas(List<HolidayFormula> allHolidayFormulas);

	/**
	 * Set the list of over time pools
	 * 
	 * @param allOverTimePools list of over time pools
	 */
	public void setOverTimePools(List<OverTimePool> allOverTimePools);

	/**
	 * Set the list of log entries
	 * 
	 * @param logEntries list of log entries
	 */
	public void setLogEntries(List<LogEntry> logEntries);

	/**
	 * Set a year config
	 * 
	 * @param yearConfig year config
	 */
	public void setYearConfig(YearConfig yearConfig);

	/**
	 * Set the detail information for a over time pool
	 * 
	 * @param allocations allocations
	 * @param hoursTotal hours total
	 * @param hoursUsed hours used
	 * @param hoursUnused hours unused
	 */
	public void setOverTimePoolDetailInformation(List<Allocation> allocations, double hoursTotal, double hoursUsed,
			double hoursUnused);

	/**
	 * Set the daily presence
	 * 
	 * @param presence daily presence
	 */
	public void setDailyPresence(DailyPresence presence);

	/**
	 * Set the total time of presence
	 * 
	 * @param presenceTimeTotal total time of presence
	 */
	public void setPresenceTimeTotal(Time presenceTimeTotal);

	/**
	 * Set the unused time of presence
	 * 
	 * @param presenceTimeUnused unused time of presence
	 */
	public void setPresenceTimeUnused(Time presenceTimeUnused);

	/**
	 * Set the over time pool
	 * 
	 * @param overTimePool over time pool
	 */
	public void setOverTimePool(OverTimePool overTimePool);

	/**
	 * Show the "Create entry" window
	 * 
	 * @param availableHours available hours
	 */
	public void showCreateEntryWindow(Time availableHours);
	
	/**
	 * Show the "Edit entry" window
	 * 
	 * @param availableHours available hours
	 * @param entry entry to edit
	 */
	public void showEditEntryWindow(Time availableHours, Entry entry);

	/**
	 * Set a list of periods
	 * 
	 * @param periods list of periods
	 */
	public void setPeriods(List<Period> periods);

	/**
	 * Set the statistic object
	 * 
	 * @param statisticObj statistic object
	 */
	public void setStatistic(Statistic statisticObj);

	/**
	 * Set the year for statistic
	 * 
	 * @param year year for statistic
	 */
	public void setStatisticYear(int year);

	/**
	 * Change the editability of the actual year config
	 * 
	 * @param enabled editable?
	 */
	public void setYearConfigEnabled(boolean enabled);

}
